package com.atguigu.Mytest;


import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;

public class CallableDemo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<Integer> futureTask  = new FutureTask(()->{
            System.out.println("----------0325----------");
            try { TimeUnit.SECONDS.sleep(4); } catch (InterruptedException e) { e.printStackTrace(); }
            return 9999;
        });

        new Thread(futureTask,"t1").start();

        System.out.println("--------------------main");
        System.out.println(futureTask.get());

    }
}




